package site.yunnong.atvris.admin.controller;

import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import site.yunnong.atvris.dao.admin.service.SysVideoManageService;
import site.yunnong.atvris.dao.common.api.CommonResult;
import site.yunnong.atvris.dao.common.util.LocalAssert;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 *
 * @author JingHaoZhang
 * @date 2021-06-29
 */
@Api(tags = "视频管理模块")
@RestController
@RequestMapping("/sys/video")
public class SysVideoManageController {

    @Resource
    private SysVideoManageService sysVideoManageService;

    @PatchMapping("/permission")
    public CommonResult<Object> changeVideoPermission(@Valid @NotNull @RequestParam("id") Long id,
                                                      @Valid @NotNull @RequestParam("status") Integer status) {
        int count = sysVideoManageService.changeVideoPermission(id, status);
        LocalAssert.notZero(count, "请求失败");
        return CommonResult.success();
    }
}
